from django.http import HttpResponse
from django.shortcuts import render
from stu.models import  *

# Create your views here.


def index_view(request):
    if request.method == 'GET':
        return render(request,"register.html")
    else:
        sname = request.POST.get("sname","")
        cname=request.POST.get('clsname',"")
        coursenames=request.POST.getlist('coursename',[])

        flag= registerStu(sname,cname,*coursenames)
        if flag :
            return HttpResponse('注册成功！')
        return HttpResponse